list
用途
列出domain类的所以实例。
举例
// list everything
def results = Book.list()
// list 10 results
def results = Book.list(max:10)
// list 10 results, offset by 100
def results = Book.list(max:10, offset:100)
// list 10 results, offset by 100, orderd by title in descending order
def results = Book.list(max:10, offset:100, sort:"title", order:"desc")// list all books, eagerly fetching the authors association
def results = Book.list(fetch:[authors:"eager"])
描述
参数
max
- 列出的最大数
offset
- 从给定的偏移处开始列出
order
- 列出的顺序,"desc"
(降序)或者"asc"
(升序)
sort
- 排序用的属性名
ignoreCase
- 排序的时候,是否忽视大小写,默认为true
fetch
- 一个Map,定义关联对象的抓取策略